package mvc.effects.impl;

import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;

import mvc.effects.INonParameterizedEffect;

@SuppressWarnings("nls")
public class Rotate180Effect implements INonParameterizedEffect {

	private AffineTransform aft;
	private BufferedImageOp rotate180;
	private final String EFFECT_NAME = "Rotate 180 degrees";

	public Rotate180Effect() {
	}

	@Override
	public BufferedImage applyEffect(BufferedImage img) {

		aft = AffineTransform.getRotateInstance(Math.PI, img.getWidth() / 2,
				img.getHeight() / 2);
		rotate180 = new AffineTransformOp(aft, null);

		return rotate180.filter(img, null);
	}

	@Override
	public BufferedImageOp getEffect() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String toString() {

		return EFFECT_NAME;
	}

}
